package com.example.base.freemarker.util;

import com.alibaba.fastjson.JSON;
import com.example.base.freemarker.FreemarkerScan;
import freemarker.template.TemplateMethodModelEx;
import freemarker.template.TemplateModelException;

import java.util.List;

/**
 * @Classname GetJSONString
 * @Description TODO
 * @Date 2022/3/18 9:37
 * @Created by XiongXiong
 * @Author: X.I.O
 */
@FreemarkerScan("GetJSONString")
public class GetJSONString implements TemplateMethodModelEx {

    @Override
    public Object exec(List arguments) throws TemplateModelException {
        System.out.println(JSON.toJSONString(arguments.get(0)));
        return JSON.toJSONString(arguments.get(0));
    }
}
